#include <iostream>
#include <string>
using namespace std;
bool checkBrackets(string input) {
    int countRound = 0, countSquare = 0, countCurly = 0, countAngle = 0;

    for (char bracket : input) {
        if (bracket == '(') {
            countRound++;
        } else if (bracket == ')') {
            countRound--;
            if (countRound < 0) {
                return false;
            }
        } else if (bracket == '[') {
            countSquare++;
        } else if (bracket == ']') {
            countSquare--;
            if (countSquare < 0) {
                return false;
            }
        } else if (bracket == '{') {
            countCurly++;
        } else if (bracket == '}') {
            countCurly--;
            if (countCurly < 0) {
                return false;
            }
        } else if (bracket == '<') {
            countAngle++;
        } else if (bracket == '>') {
            countAngle--;
            if (countAngle < 0) {
                return false;
            }
        }
    }

    return countRound == 0 && countSquare == 0 && countCurly == 0 && countAngle == 0;
}

int main() {
    string input;
    cin >> input;

    cout << (checkBrackets(input) ? "True" : "False") << endl;
    return 0;
}
